.row.text-center
  .col-md-12
    h2 Download our #{process.env.WEBSITE_APP_TITLE || 'Electron App'}
      small.pull-right
        | Channel: 
        select(
          ng-model='vm.channel'
          ng-options='channel for channel in vm.availableChannels'
          ng-change='vm.getLatestReleases()'
          )
      small.pull-left
        | Flavor: 
        select(
          ng-model='vm.flavor'
          ng-options='flavor for flavor in vm.availableFlavors'
          ng-change='vm.getLatestReleases()'
          )
.row.text-center.padding-top-20(ng-if="vm.latestReleases")
  .col-md-12(ng-if="vm.platform === 'osx' && vm.latestReleases['64']")
    .jumbotron
      h4 OS X 
        span.text-muted 64 bit INTEL
      a.btn.btn-success.btn-lg(
        ng-click="vm.download(vm.latestReleases['64'])"
        )
        i.fa.fa-download.fa-5x
        h5 {{ vm.latestReleases['64'].version }} 
          label.label.label-info(
            ng-show="vm.latestReleases['64'].channel !== 'stable'"
            )
            | {{ vm.latestReleases['64'].channel }}
      .padding-top-20.text-muted
        span.timestamp(am-time-ago="vm.latestReleases['64'].createdAt")
      .padding-top-20(ng-show="vm.latestReleases['64'].notes")
        h4 Change Notes
        p.release-notes.text-muted(
          ng-bind="vm.latestReleases['64'].notes"
          )
  .col-md-12(ng-if="vm.platform === 'osx' && vm.latestReleases['arm64']")
    .jumbotron
      h4 OS X 
        span.text-muted 64 bit ARM
      a.btn.btn-success.btn-lg(
        ng-click="vm.download(vm.latestReleases['arm64'])"
        )
        i.fa.fa-download.fa-5x
        h5 {{ vm.latestReleases['arm64'].version }} 
          label.label.label-info(
            ng-show="vm.latestReleases['arm64'].channel !== 'stable'"
            )
            | {{ vm.latestReleases['arm64'].channel }}
      .padding-top-20.text-muted
        span.timestamp(am-time-ago="vm.latestReleases['arm64'].createdAt")
      .padding-top-20(ng-show="vm.latestReleases['arm64'].notes")
        h4 Change Notes
        p.release-notes.text-muted(
          ng-bind="vm.latestReleases['arm64'].notes"
          )
  div(ng-if="vm.platform !== 'osx'")
    .row
      .col-md-12
        h4.text-capitalize {{ vm.platform }}
    .row
      div(
        ng-if="vm.latestReleases['32']",
        ng-class="vm.latestReleases['64'] ? 'col-sm-6' : 'col-sm-12'"
        )
        h5.text-muted 32 bit
        a.btn.btn-success.btn-lg(
          ng-click="vm.download(vm.latestReleases['32'])"
          )
          i.fa.fa-download.fa-5x
          h5 {{ vm.latestReleases['32'].version }} 
            label.label.label-info(
              ng-show="vm.latestReleases['32'].channel !== 'stable'"
              )
              | {{ vm.latestReleases['32'].channel }}
        .padding-top-20.text-muted
          span.timestamp(am-time-ago="vm.latestReleases['64'].createdAt")
        .padding-top-20(ng-show="vm.latestReleases['32'].notes")
          h4 Change Notes
          p.release-notes.text-muted(
            ng-bind-html="vm.latestReleases['32'].notes"
            )
      div(
        ng-if="vm.latestReleases['64']",
        ng-class="vm.latestReleases['32'] ? 'col-sm-6' : 'col-sm-12'"
        )
        h5.text-muted 64 bit
        a.btn.btn-success.btn-lg(
          ng-click="vm.download(vm.latestReleases['64'])"
          )
          i.fa.fa-download.fa-5x
          h5 {{ vm.latestReleases['64'].version }} 
            label.label.label-info(
              ng-show="vm.latestReleases['64'].channel !== 'stable'"
              )
              | {{ vm.latestReleases['64'].channel }}
        .padding-top-20.text-muted
          span.timestamp(am-time-ago="vm.latestReleases['64'].createdAt")
        .padding-top-20(ng-show="vm.latestReleases['64'].notes")
          h4 Change Notes
          p.release-notes.text-muted(
            ng-bind-html="vm.latestReleases['64'].notes"
            )

.row.text-center.padding-top-20(ng-if="!vm.latestReleases")
  .col-md-12
    h5.text-muted
      | The {{ vm.flavor }} flavor has no {{ vm.channel }} releases available for {{ vm.platform }}.
      
.row.text-center.padding-20-0
  .col-sm-8.col-sm-offset-2
    h5.pointer(
      ng-click="vm.showAllVersions = !vm.showAllVersions"
      )
      span(ng-show="vm.showAllVersions") Hide
      span(ng-hide="vm.showAllVersions") Show
      |  all versions
    div(ng-show="vm.showAllVersions")
      .jumbotron(ng-repeat='version in vm.versions')
        p.timestamp.text-muted(am-time-ago="version.createdAt")
        h4 {{ version.name }} 
          label.label(
            ng-class="version.channel.name === 'stable' ? 'label-success' : 'label-info'"
            )
            | {{ version.channel.name }}
        p.release-notes.text-muted(
          ng-show="version.notes"
          ng-bind-html="version.notes"
          )
        button.btn.btn-sm.btn-success.download-btn(
          ng-repeat="asset in version.assets"
          ng-click="vm.download(asset, version.name, version.flavor.name)"
          ng-if="vm.filetypes[asset.platform].includes(asset.filetype)"
          )
          | {{ vm.availablePlatforms[asset.platform] }}
          | ({{ asset.filetype }})
      .btn-group
        a.btn.btn-default(ng-show="vm.showAllVersions && hasMoreVersions" ng-click="loadMoreVersions()") Load more versions

iframe(
  style="display:none;"
  ng-if="vm.downloadUrl"
  width="1"
  height="1"
  frameborder="0"
  ng-src="{{vm.downloadUrl}}"
  )
